import { Card } from 'antd';
import type { CardProps } from 'antd/es/card';
import React from 'react';
import Styles from './index.less';

const CustomCard: React.FC<
  CardProps & {
    hasHeaderBorder?: boolean;
  }
> = ({ children, className, headStyle = {}, bodyStyle = {}, hasHeaderBorder = false, ...rest }) => {
  let _headStyle = {
    borderBottom: '1px solid #e0e0e0',
  };
  let _bodyStyle = {};
  if (!hasHeaderBorder) {
    _headStyle = { border: 'none' };
    _bodyStyle = { paddingTop: 0 };
  }
  return (
    <Card
      className={`${Styles.customCard} ${className}`}
      headStyle={{ ..._headStyle, ...headStyle }}
      bodyStyle={{ ..._bodyStyle, ...bodyStyle }}
      {...rest}
    >
      {children}
    </Card>
  );
};
export default CustomCard;
